﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Master/ConfigAdmin.Master"
    AutoEventWireup="true" CodeBehind="FieldAdd.aspx.cs" Inherits="Besture.UI.Admin.CommonModel.FieldAdd" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="server">
    <style type="text/css">
        input[type="checkbox"] + label
        {
            background: url(checkstyle.gif) no-repeat;
            padding-left: 18px;
            color: #ccc;
        }
        input[type="checkbox"] + label:hover
        {
            color: #369;
            background-position: 0 -16px;
        }
        input[type="checkbox"]:checked + label
        {
            color: #000;
            background-position: 0 -48px;
        }
        input[type="checkbox"]:focus + label
        {
            color: #963;
            background-position: 0 -32px;
        }
        
        
        input[type="radio"] + label
        {
            background: url(checkstyle.gif) no-repeat 0 -64px;
            padding-left: 5px;
            color: #ccc;
            padding-right: 10px;
        }
        input[type="radio"] + label:hover
        {
            color: #000;
            background-position: 0 -80px;
        }
        input[type="radio"]:checked + label
        {
            color: #000;
            background-position: 0 -112px;
        }
        input[type="radio"]:focus + label
        {
            color: #000;
            background-position: 0 -96px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Content" runat="server">
    <div class="mainbox">
        <div class="setTabCont">
            <div>
                <table width="98%" cellspacing="0" cellpadding="0" class="table_form">
                    <tr>
                        <th>
                            字段名称：
                        </th>
                        <td>
                            <cms:TextBox ID="txtName" Required="True" WidthExt="Width_400" runat="server"></cms:TextBox>
                            <br />
                            <font style="font-size: 12px; color: #666666;">&nbsp;※注：字段名由字母、数字、下划线组成。 例如：Content</font>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            字段别名：
                        </th>
                        <td>
                            <cms:TextBox ID="txtAlias" Required="True" WidthExt="Width_400" runat="server"></cms:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            字段提示：
                        </th>
                        <td>
                            <cms:TextBox ID="txtTips" WidthExt="Width_400" runat="server"></cms:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            列表显示：
                        </th>
                        <td>
                            <asp:DropDownList runat="server" ID="ddlListDisplay">
                                <asp:ListItem runat="server" Value="0" Text="不显示"></asp:ListItem>
                                <asp:ListItem runat="server" Value="50" Text="50px"></asp:ListItem>
                                <asp:ListItem runat="server" Value="100" Text="100px"></asp:ListItem>
                                <asp:ListItem runat="server" Value="150" Text="150px"></asp:ListItem>
                                <asp:ListItem runat="server" Value="200" Text="200px"></asp:ListItem>
                                <asp:ListItem runat="server" Value="250" Text="250px"></asp:ListItem>
                                <asp:ListItem runat="server" Value="300" Text="300px"></asp:ListItem>
                                <asp:ListItem runat="server" Value="350" Text="350px"></asp:ListItem>
                                <asp:ListItem runat="server" Value="400" Text="400px"></asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <th style="width: 150px">
                            字段类型：
                        </th>
                        <td>
                            &nbsp;
                            <input id="radioFieldType_1" class="radioFieldType" name="rdFieldType" type="radio"
                                value="1" /><label for="radioFieldType_1">单行文本</label>
                            <input id="radioFieldType_2" class="radioFieldType" name="rdFieldType" type="radio"
                                value="2" /><label for="radioFieldType_2">多行文本</label>
                            <input id="radioFieldType_3" class="radioFieldType" name="rdFieldType" type="radio"
                                value="3" /><label for="radioFieldType_3">富文本</label>
                            <input id="radioFieldType_4" class="radioFieldType" name="rdFieldType" type="radio"
                                value="4" /><label for="radioFieldType_4">选项</label>
                            <input id="radioFieldType_5" class="radioFieldType" name="rdFieldType" type="radio"
                                value="5" /><label for="radioFieldType_5">图片</label>
                            <input id="radioFieldType_6" class="radioFieldType" name="rdFieldType" type="radio"
                                value="6" /><label for="radioFieldType_6">文件</label>
                            <input id="radioFieldType_7" class="radioFieldType" name="rdFieldType" type="radio"
                                value="7" /><label for="radioFieldType_7">日期</label>
                        </td>
                    </tr>
                    <!--单行文本属性Start-->
                    <tr class="ProClass SingTextBox">
                        <th>
                            最大字符数：
                        </th>
                        <td>
                            <cms:TextBox ID="txtMaxLength" runat="server" WidthExt="Width_100" Text="200" Required="True"
                                ValidateExt="Number"></cms:TextBox>
                        </td>
                    </tr>
                    <tr class="ProClass SingTextBox">
                        <th>
                            文本框长度：
                        </th>
                        <td>
                            <cms:TextBox ID="txtBoxLength" runat="server" WidthExt="Width_100" Text="200" Required="True"
                                ValidateExt="Number"></cms:TextBox>
                        </td>
                    </tr>
                    <tr class="ProClass SingTextBox">
                        <th>
                            验证规则：
                        </th>
                        <td>
                            <asp:DropDownList runat="server" ID="ddlValidate">
                                <asp:ListItem runat="server" Text="无" Value="0"></asp:ListItem>
                                <asp:ListItem runat="server" Text="邮箱地址" Value="Email"></asp:ListItem>
                                <asp:ListItem runat="server" Text="手机号码" Value="Phone"></asp:ListItem>
                                <asp:ListItem runat="server" Text="纯数字" Value="Number"></asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr class="ProClass SingTextBox">
                        <th>
                            默认值：
                        </th>
                        <td>
                            <cms:TextBox ID="txtDefaultValue" runat="server" WidthExt="Width_200"></cms:TextBox>
                        </td>
                    </tr>
                    <tr class="ProClass SingTextBox">
                        <th>
                            属性：
                        </th>
                        <td>
                            <cms:ASPxCheckBox runat="server" ID="cbRequired" Text="必输"></cms:ASPxCheckBox>
                        </td>
                    </tr>
                    <!--单行文本属性End-->
                    <!--多行文本属性Start-->
                    <tr class="ProClass MultiTextBox">
                        <th>
                            显示宽度：
                        </th>
                        <td>
                            <cms:TextBox ID="txtDisWidth" runat="server" WidthExt="Width_100" Text="800" Required="True"
                                ValidateExt="Number"></cms:TextBox>
                        </td>
                    </tr>
                    <tr class="ProClass MultiTextBox">
                        <th>
                            显示高度：
                        </th>
                        <td>
                            <cms:TextBox ID="txtDisHeight" runat="server" WidthExt="Width_100" Text="300" Required="True"
                                ValidateExt="Number"></cms:TextBox>
                        </td>
                    </tr>
                    <!--多行文本属性End-->
                    <!--选项属性Start-->
                    <tr class="ProClass Option">
                        <th>
                            选项值：
                        </th>
                        <td>
                            <asp:TextBox ID="txtOptionValue" runat="server" TextMode="MultiLine" Width="400px"
                                Height="100px"></asp:TextBox>
                            <br />
                            <font style="font-size: 12px; color: #666666;">&nbsp;※注：添加如下格式：公司公告|1，多个选项换行 </font>
                        </td>
                    </tr>
                    <tr class="ProClass Option">
                        <th>
                            显示方式：
                        </th>
                        <td>
                            <input id="rdOptionDis_1" class="radioOptionItem" checked="checked" name="rdOptionDisType"
                                type="radio" value="1" /><label for="rdOptionDis_1">单选下拉列表框</label>
                            <input id="rdOptionDis_2" class="radioOptionItem" name="rdOptionDisType" type="radio"
                                value="1" /><label for="rdOptionDis_2">单选按钮</label>
                            <input id="rdOptionDis_3" class="radioOptionItem" name="rdOptionDisType" type="radio"
                                value="1" /><label for="rdOptionDis_3">复选框</label>
                        </td>
                    </tr>
                    <!--选项属性End-->
                    <!--图片属性Start-->
                    <tr class="ProClass Photo">
                        <th>
                            允许图片类型：
                        </th>
                        <td>
                            <cms:TextBox ID="txtPhotoType" runat="server" WidthExt="Width_400" Text="jpg|png|gif|bmp"
                                Required="True"></cms:TextBox>
                            <br />
                            <font style="font-size: 12px; color: #666666;">&nbsp;※注：允许多个类型请用“|”号分割，如：jpg|gif|bmp等等</font>
                        </td>
                    </tr>
                    <tr class="ProClass Photo">
                        <th>
                            上传图片保存路径：
                        </th>
                        <td>
                            <cms:TextBox ID="txtPhotoPath" runat="server" WidthExt="Width_400" Text="/Upload/Image/"
                                Required="True"></cms:TextBox>
                            <br />
                            <font style="font-size: 12px; color: #666666;">&nbsp;※注：输入“/Upload/Image/”格式的文件路径，确保此路径已经存在</font>
                        </td>
                    </tr>
                    <!--图片属性End-->
                    <!--文件属性Start-->
                    <tr class="ProClass File">
                        <th>
                            允许文件类型：
                        </th>
                        <td>
                            <cms:TextBox ID="txtFileType" runat="server" WidthExt="Width_400" Text="doc|xls"
                                Required="True"></cms:TextBox>
                            <br />
                            <font style="font-size: 12px; color: #666666;">&nbsp;※注：允许多个类型请用“|”号分割，如：doc|xls等等</font>
                        </td>
                    </tr>
                    <tr class="ProClass File">
                        <th>
                            上传文件保存路径：
                        </th>
                        <td>
                            <cms:TextBox ID="txtFilePath" runat="server" WidthExt="Width_400" Text="/Upload/File/"
                                Required="True"></cms:TextBox>
                            <br />
                            <font style="font-size: 12px; color: #666666;">&nbsp;※注：输入“/Upload/File/”格式的文件路径，确保此路径已经存在</font>
                        </td>
                    </tr>
                    <!--文件属性End-->
                    <!--日期属性Start-->
                    <tr class="ProClass Date">
                        <th>
                            默认系统时间：
                        </th>
                        <td>
                            <asp:CheckBox runat="server" ID="cbDefaultTime" Text="是" />
                        </td>
                    </tr>
                    <!--日期属性End-->
                    <input type="hidden" id="hidFieldType" name="hidFieldType" value="1" />
                </table>
            </div>
        </div>
        <div class="buttonDiv">
            <asp:Button runat="server" ID="btnSubmit" CssClass="button" Text="保存" OnClick="btnSubmit_Click" />
            <input type="button" class="button" value="取消" onclick="location.href='FieldList.aspx?ModelID=<%=_ModelID %>'" />
        </div>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            $('input[name="rdFieldType"]').each(function () {
                $(this).click(function () {
                    $(".ProClass").hide();

                    $(this).siblings().removeClass("on");
                    $(this).addClass("on");

                    var $selectedvalue = $(this).attr("value");
                    //单行文本
                    if ($selectedvalue == "1") {
                        $(".SingTextBox").show();
                        $("#hidFieldType").val("1");
                    }
                    //多行文本
                    else if ($selectedvalue == "2") {
                        $(".MultiTextBox").show();
                        $("#hidFieldType").val("2");
                    }
                    //多行文本
                    else if ($selectedvalue == "3") {
                        $(".MultiTextBox").show();
                        $("#hidFieldType").val("3");
                    }
                    //选项
                    else if ($selectedvalue == "4") {
                        $(".Option").show();
                        $("#hidFieldType").val("4");
                    }
                    //图片
                    else if ($selectedvalue == "5") {
                        $(".Photo").show();
                        $("#hidFieldType").val("5");
                    }
                    //文件
                    else if ($selectedvalue == "6") {
                        $(".File").show();
                        $("#hidFieldType").val("6");
                    }
                    //日期
                    else if ($selectedvalue == "7") {
                        $(".Date").show();
                        $("#hidFieldType").val("7");
                    }
                });
            });

            $('input[name="rdFieldType"]').first().click();

        });
            

    </script>
</asp:Content>
